package org.apache.jsp.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.pomirkovany.beans.Item;
import java.util.Enumeration;
import java.util.Hashtable;

public final class additem_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      org.pomirkovany.model.DataAccess dataAccess = null;
      synchronized (application) {
        dataAccess = (org.pomirkovany.model.DataAccess) _jspx_page_context.getAttribute("dataAccess", PageContext.APPLICATION_SCOPE);
        if (dataAccess == null){
          dataAccess = new org.pomirkovany.model.DataAccess();
          _jspx_page_context.setAttribute("dataAccess", dataAccess, PageContext.APPLICATION_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');

  String base = (String)application.getAttribute("base");
  String imageURL = (String)application.getAttribute("imageURL");
  
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\r\n");
      out.write("  <title>Item details</title>\r\n");
      out.write("  <link rel=\"stylesheet\" href=\"/Cataloguer/css/cataloguer.css\" type=\"text/css\"/>\r\n");
      out.write("  </head>\r\n");
      out.write("<body>\r\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "header.jsp", out, true);
      out.write('\r');
      out.write('\n');
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "SearchBar.jsp", out, true);
      out.write('\r');
      out.write('\n');
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "typesmenu.jsp", out, true);
      out.write("\r\n");
      out.write("<div class=\"content\">\r\n");
      out.write("  <h2>Add item</h2>\r\n");
      out.write("  \r\n");
      out.write("  <form style=\"border: 0px solid; padding: 0; margin: 0;\">\r\n");
      out.write("      <input type=\"hidden\" name=\"action\" value=\"itemEntered\"/>\r\n");
      out.write("      name<br /><input id=\"text\" type=\"text\" name=\"name\" size=\"45\"/><br />\r\n");
      out.write("      author<br /><input id=\"text\" type=\"text\" name=\"author\" size=\"45\"/><br />\r\n");
      out.write("      owner<br /><input id=\"text\" type=\"text\" name=\"owner\" size=\"45\"/><br />\r\n");
      out.write("      borrowed<br /><input type=\"checkbox\" name=\"borrowed\" value=\"true\" /> <br />\r\n");
      out.write("      location<br /><input id=\"text\" type=\"text\" name=\"location\" size=\"45\"/><br />\r\n");
      out.write("      comment<br /><input id=\"text\" type=\"text\" name=\"comment\" size=\"45\"/><br />\r\n");
      out.write("      \r\n");
      out.write("      category<br /><select name=\"category\">\r\n");
      out.write("      ");
 
    Hashtable categories = dataAccess.getCategories();
    Enumeration categoryIds = categories.keys();
    while (categoryIds.hasMoreElements()) {
      Object categoryId = categoryIds.nextElement();
      out.write("\r\n");
      out.write("\t\t<option value=\"");
 out.print(categories.get(categoryId)); 
      out.write('"');
      out.write('>');
 out.print(categories.get(categoryId)); 
      out.write("</option>\r\n");
      out.write("        ");
 }
      out.write("\r\n");
      out.write("\t\t</select><br /><br />\r\n");
      out.write("        \r\n");
      out.write("        rate<br />\r\n");
      out.write("        <input type=\"radio\" name=\"rate\" value=\"1\" checked/> <img src=\"");
      out.print((imageURL));
      out.write("1s.png\" width=\"16%\" height=\"16%\"/><br />\r\n");
      out.write(" \t\t<input type=\"radio\" name=\"rate\" value=\"2\" /> <img src=\"");
      out.print((imageURL));
      out.write("2s.png\" width=\"16%\" height=\"16%\"/><br />\r\n");
      out.write("        <input type=\"radio\" name=\"rate\" value=\"3\" /> <img src=\"");
      out.print((imageURL));
      out.write("3s.png\" width=\"16%\" height=\"16%\"/><br />\r\n");
      out.write("        <input type=\"radio\" name=\"rate\" value=\"4\" /> <img src=\"");
      out.print((imageURL));
      out.write("4s.png\" width=\"16%\" height=\"16%\"/><br />\r\n");
      out.write("        <input type=\"radio\" name=\"rate\" value=\"5\" /> <img src=\"");
      out.print((imageURL));
      out.write("5s.png\" width=\"16%\" height=\"16%\"/><br /><br />\r\n");
      out.write("       \r\n");
      out.write("        \r\n");
      out.write("        \r\n");
      out.write("       \r\n");
      out.write("      \r\n");
      out.write("      <input id=\"submit\" type=\"submit\" value=\"add item\"/>\r\n");
      out.write("    </form>  \r\n");
      out.write("    \r\n");
      out.write("\r\n");
      out.write("  </div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
